package main
import(
	"http"
	"fmt"
	"runtime"
)
var RequestCount int=0
var OnRequestChan chan int
func main(){
	Log("Read Config...")
	ReadConfig("")
	Log("Start Server...")
	OnRequestChan=make(chan int)
	http.HandleFunc("/",RootHandler)
	http.HandleFunc("/get_property",GetPropertyHandler)
	http.HandleFunc("/file",GetFileHandler)
	http.HandleFunc("/download",DownloadHandler)
	http.HandleFunc("/thumbnail",ThumbnailsHandler)
	go garbageCollection()
	err:=http.ListenAndServe(":"+fmt.Sprint(Config.Port),nil)
	LogError(err)
}
func garbageCollection(){
	for i:=range OnRequestChan{
		if(i%100==0){
			Log("GC..")
			runtime.GC()
		}
	}
}
